/*
 * TestGetName.cpp
 *
 *  Created on: May 3, 2012
 *      Author: Shuo Chang <schang@cs.umn.edu>
 */

#include <limits.h>
#include "CommandHelper.h"
#include "gtest/gtest.h"


TEST(CommandHelper, StudentID) {
    EXPECT_TRUE(CommandHelper::getStudent("1865415")->getStudentId() == "1865415");
}

TEST(CommandHelper, Number) {
    vector<TranscriptFactory::StudentInfo> studentList =TranscriptFactory::getStudentList();
    EXPECT_TRUE(CommandHelper::getStudent("1")->getStudentId() == studentList[0].studentId);
}

TEST(CommandHelper, InValid) {
    tr1::shared_ptr<TranscriptParser> student;
    try{
        student = CommandHelper::getStudent("412");
    }
    catch(logic_error& err)
    {
        cout<<err.what()<<endl;
    }
    EXPECT_TRUE(student == NULL);
    try{
            student = CommandHelper::getStudent("sad");
        }
        catch(logic_error& err)
        {
            cout<<err.what()<<endl;
        }
    EXPECT_TRUE(student == NULL);
}

